<template>
  <div>
    {{ person.name}} -- {{ person.age }}
    <button @click="updateName">修改</button>
  </div>
</template>

<script lang="ts" setup name="Person">
  import { reactive, toRefs } from 'vue'

  let person = reactive({
    name: 'ljw',
    age: 23
  })

  let { name,age } = toRefs(person)

  function updateName() {
    name.value = 'hello'
    age.value = 12
  }
</script>
